package com.yixiu.study.juc.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

/**
 * @CalssName T01_Future
 * @Description
 * @Author yixiu
 * @Date 2021/6/29 10:28
 * @Verison 1.0
 **/
public class T01_Future {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> task = new FutureTask<>(() -> {
            TimeUnit.MILLISECONDS.sleep(500);
            return 100;
        });

        new Thread(task).start();

        System.out.println(task.get());
    }

}
